﻿using FluentValidation;
using Nop.Admin.Models.XJ;
using Nop.Core.Domain.XJ;
using Nop.Data;
using Nop.Web.Framework.Validators;

namespace Nop.Admin.Validators.XJ
{
	public partial class EquipmentValidator : BaseNopValidator<EquipmentModel>
	{
		public EquipmentValidator(IDbContext dbContext)
		{
			RuleFor(x => x.Name).NotEmpty().WithMessage("设施设备名称不能为空");
			RuleFor(x => x.CategoryMainId).GreaterThan(0).WithMessage("请选择类别");
			RuleFor(x => x.CategoryId).GreaterThan(0).WithMessage("请选择分类");

			SetDatabaseValidationRules<XJEquipment>(dbContext);
		}
	}
}